package dnl.dev.memlog;

import java.util.List;

import javax.swing.table.DefaultTableModel;

/**
 * 
 */
class TModel extends DefaultTableModel {
	List<String> classNames;
	List<StatisticalData> statisticalData;

	public TModel(List<String> classNames, List<StatisticalData> statisticalData) {
		this.classNames = classNames;
		this.statisticalData = statisticalData;
	}

	@Override
	public Object getValueAt(int row, int column) {
		if (column == 0) {
			return this.classNames.get(row);
		}
		if (column == 1) {
			return this.statisticalData.get(row).getVariance();
		}
		if (column == 2) {
			return this.statisticalData.get(row).getMean();
		}
		return null;
	}

	@Override
	public int getRowCount() {
		if (this.classNames == null) {
			return 0;
		}
		return this.classNames.size();
	}

	@Override
	public int getColumnCount() {
		return 3;
	}

	@Override
	public String getColumnName(int column) {
		if (column == 0) {
			return "Class Name";
		}
		if (column == 1) {
			return "Variance";
		}
		if (column == 2) {
			return "Mean";
		}
		return null;
	}

}